package com.springmvc.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.lang.annotation.Annotation;

@ControllerAdvice
@ResponseBody
public class ExceptionHandlerConfig {
    @ExceptionHandler(Exception.class)
    public String handleException(Exception e) {
        String message = e.getMessage();
        return message;
    }

}

